package com.yanqu.road.server.cmd.activity.stronghold.eliminate;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.pb.activity.StrongholdWarProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.strongholdwar.StrongholdActivityMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = GameProtocol.S_STRONGHOLD_WAR_ELIMINATION_UNION_DATA, desc = "")
public class GetEliminateUnionListCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        StrongholdWarProto.CrossGetEliminateUnionListReqMsg.Builder req = StrongholdWarProto.CrossGetEliminateUnionListReqMsg.newBuilder();
        ActivityInfo activityInfo = StrongholdActivityMgr.getOpenActivityInfo();
        if (activityInfo != null) {
            req.setActivityId(activityInfo.getActivityId());
            String unionUid = player.getUserInfo().getUnionUid();
            if (unionUid != null) {
                req.setUnionId(unionUid);
            }else {
                req.setUnionId("");
            }
            player.sendUnionActivityGroupPacket(Protocol.C_CROSS_STRONGHOLD_WAR_ELIMINATION_UNION_LIST, req, req.getActivityId());
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
